package com.samehope.ar.mapper;

import com.samehope.ar.entity.PatrolItemType;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.samehope.ar.vo.FormSelectVO;
import com.samehope.ar.vo.TreeDataVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 巡检项分类表 Mapper 接口
 * </p>
 *
 * @author Zhang Luo
 * @since 2019-12-23
 */
public interface PatrolItemTypeMapper extends BaseMapper<PatrolItemType> {

    /**
     * 根据项目和分类名称查找检查项分类
     * @param projectId
     * @param name
     * @return
     */
    PatrolItemType findByProjectAndItemTypeName(@Param("projectId") Long projectId,
                                                @Param("name") String name);

    /**
     * 根据项目和分类ID查找检查项分类
     * @param projectId
     * @param itemTypeId
     * @return
     */
    PatrolItemType findByProjectAndItemType(@Param("projectId") Long projectId,
                                            @Param("itemTypeId") Long itemTypeId);

    /**
     * 巡检项分类下拉选视图对象集合
     * @param projectId
     * @return
     */
    List<FormSelectVO> typesForSelectByProject(Long projectId);

    /**
     * 巡检项分类树结构
     * @param projectId
     * @param condition
     * @return
     */
    List<TreeDataVO> findTreeByProjectAndCondition(@Param("projectId") Long projectId,
                                                   @Param("condition") String condition);
}
